<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.1</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/xadmin/css/font.css">
    <link rel="stylesheet" href="/xadmin/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/xadmin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/xadmin/js/xadmin.js"></script>
    <script type="text/javascript" src="/xadmin/js/cookie.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<link rel="stylesheet" href="/xadmin/lib/layui/css/modules/laydate/default/laydate.css">
<script src="/js/jquery-1.8.3.js"></script>
<input type="hidden" name="_token" id='token' value="{{csrf_token()}}"/>
<body>
<div class="x-body">
    <input type="hidden" name="id" id="id" value="{{$data->id}}">
    <span class="x-red">*</span>房间号

    <input type="text" id="room_id" name="room_id" value="{{$data->room_id}}">
    <br /><br />

    <span class="x-red">*</span>客户名称
    <input type="text" id="user_id" name="user_id" value="{{$data->user_id}}">
    <br /><br />

    <span class="x-red">*</span>销售代表

    <input type="text" id="sale_id" name="sale_id" value="{{$data->sale_id}}">
    <br /><br />




    <span class="x-red">*</span>详情

    <textarea rows="5" cols="50" name="details" id="details" >{{$data->details}}</textarea>
    <br /><br />

    <span class="x-red">*</span>状态
    <input type="text" id="status" name="status" value="{{$data->status}}"><br /><br />

    <span class="x-red">*</span>看房次数
    <input type="text" id="number" name="number" value="{{$data->number}}">
    <br /><br />







    <button  class="layui-btn"  id="submit" onclick="updjou()">
        修改
    </button>


</div>

<script type="text/javascript">
    //监听提交
    function updjou() {

        var id = $('#id').val();
        var room_id = $('#room_id').val();
        var user_id = $('#user_id').val();
        var sale_id = $('#sale_id').val();
        var details = $('#details').val();
        var status = $('#status').val();
        var number = $('#number').val();
        var token = $('#token').val();
        console.log(id);
        console.log(room_id);
        console.log(user_id);
        console.log(sale_id);
        console.log(details);
        console.log(status);
        console.log(number);

        var data = new FormData();
        data.append('id', id);
        data.append('room_id', room_id);
        data.append('user_id', user_id);
        data.append('sale_id', sale_id);
        data.append('details', details);
        data.append('status', status);
        data.append('number', number);
        data.append('_token', token);

        $.ajax({
            type: 'post',
            url: "{{url('admin/upd_journal')}}",
            data: data,
            cache: false,
            processData: false,
            contentType: false,

            success: function (msg) {

                if (msg == 1){
                    alert('修改OK');
                    location.href="{{url('/admin/journal')}}"
                } else {
                    alert('修改失败');

                }
            }
        });


    }


</script>